using MbUnit.Framework;
using resharperupdate.core.dto;
using resharperupdate.core.dto.impl;
using resharperupdate.core.services.impl;

namespace resharperupdate.core.tests
{
    [TestFixture]
    public class NightlyBuildParserSpecs
    {
        [Test]
        public void should_match_this_entry()
        {
            string file_name =
                @"C:\code\my.opensource\resharper-updater\product\resharperupdate.core.tests\data\ReSharper+5.0+Nightly+Builds.htm";
            string input_html = new FileTask().load(file_name);
            var expected = new Build
                               {
                                   Date = "19 Oct 2009",
                                   Number = 1517,
                                   Url =
                                       "http://download.jetbrains.com/resharper/ReSharperSetup.5.0.1517.12.msi",
                                   Rating = 2.5m,
                                   Comments = "First Public Build",
                                   Status = BuildStatus.Normal
                               };

            IBuild actual = new NightlyBuildParser().parse(input_html);
            Assert.AreEqual(expected.Date, actual.Date);
            Assert.AreEqual(expected.Number, actual.Number);
            Assert.AreEqual(expected.Url, actual.Url);
            Assert.AreEqual(expected.Rating, actual.Rating);
            Assert.AreEqual(expected.Comments, actual.Comments);
            Assert.AreEqual(expected.Status, actual.Status);
        }
    }
}